package org.jeecg.modules.icms.match.enums;

/**
 * @author 202304929
 */

public enum MatchStatusEnum {

    // 完全匹配
    FULLY_MATCHED("完全匹配", "要求报关已报关"),
    // 报关数量少
    CUSTOMS_SHORT("报关数量少", "要求报关未报关"),
    // 报关数量大
    CUSTOMS_EXCEEDED("报关数量大", "要求报关已报关"),
    // 开票单无此件
    INVOICE_MISSING("开票单无此件", null),
    // 报关单无此件
    CUSTOMS_MISSING("报关单无此件", null);

    /**
     * 匹配情况
     */
    private final String matchingSituation;
    /**
     * 报关状态
     */
    private final String customsStatus;

    MatchStatusEnum(String matchingSituation, String customsStatus) {
        this.matchingSituation = matchingSituation;
        this.customsStatus = customsStatus;
    }

    public String getMatchingSituation() {
        return matchingSituation;
    }

    public String getCustomsStatus() {
        return customsStatus;
    }

    /**
     * 根据开票单和报关单的零件数量来确定匹配状态
     * @param invoiceQuantity
     * @param customsQuantity
     * @return
     */
    public static MatchStatusEnum determineMatchingStatus(Double invoiceQuantity, Double customsQuantity) {
        if (invoiceQuantity.equals(customsQuantity)) {
            return FULLY_MATCHED;
        } else if (invoiceQuantity > customsQuantity) {
            return CUSTOMS_SHORT;
        } else if (invoiceQuantity < customsQuantity) {
            return CUSTOMS_EXCEEDED;
        }
        // 如果两者都不匹配，返回默认或未知状态
        return null;
    }
}
